package com.cloud.mall.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @Author: 梁二东
 * @Date: 2024/12/9 13:52
 * @Description:
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GeneralResponse<T> {

    private Integer code;

    private T data;

    public static <T> GeneralResponse<T> success(T data) {
        return new GeneralResponse<>(0, data);
    }

    public static <T> GeneralResponse<T> fail(T data) {
        return new GeneralResponse<>(500, data);
    }

}
